<#assign selectedAddressField = JiveGlobals.getJiveProperty("plugin.waw.memberMap.address")?default('0')/>
<#assign selectedDisplayField = JiveGlobals.getJiveProperty("plugin.waw.memberMap.display")?default('0')/>
<#assign selectedInfoFields = JiveGlobals.getJiveProperty("plugin.waw.memberMap.info")?default('0')/>
<#assign selectedGroupField = JiveGlobals.getJiveProperty("plugin.waw.memberMap.group")?default('0')/>

<#function isDisplayedField fieldID>
	<#list selectedInfoFields?split(",") as displayed>
		<#if fieldID == displayed?trim><#return true></#if>
	</#list>
	<#return false>
</#function>
<html>
    <head>   	
        
        <title>Community map admin</title>        
    </head>
  <body>
  
<script type="text/javascript">    
  
 function validate(f) {
  if(f.gmapKey.value=="") {
   alert("Please enter a Google Maps key.")
   return false;
  }
  return true;
 }
 
 </script>    
  
  

                <h1 style="float:left">Member Map Administration</h1>                
                    
                    <br clear="all" />

                <!-- BEGIN content box -->
                <div class="jive-body-contentBox">
                    
                    <style type="text/css">
    #license-seat-error {
        padding : 5px 5px 5px 5px;
        border : 1px solid black;
        background-color : red;
    }
    #license-seat-warn {
        padding : 5px 5px 5px 5px;
        border : 1px solid black;
        background-color : yellow;
    }
</style>

<p>The <em>Member Map Plugin</em> maps the members of a community on a Google Map accessible from the <em>Members</em> tab of your community.  
Location information is updated each time users modify their profile.</p>

<p>Google Maps requires a unique key for each website.
Go to <a href="http://www.google.com/apis/maps/signup.html" target="_blank">http://www.google.com/apis/maps/signup.html</a> to get a key.
</p>

  <#if (JiveGlobals.getJiveProperty("plugin.waw.memberMap.key")?exists)>     
      <p>Your Google Maps key is <b>${JiveGlobals.getJiveProperty("plugin.waw.memberMap.key")}</b>.  To update your key use the form below.
  <#else>      
      <p>You need to define a Google Maps key.  Go to <a href="http://www.google.com/apis/maps/signup.html" target="_blank">http://www.google.com/apis/maps/signup.html</a>
to get your key and enter it in the form below before using the Google Map community plugin.
  </#if>  
<p>&nbsp;

<form action="members-admin.jspa" onsubmit="return validate(this);" method="post" name="createKey">

<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
    <tr>
        <th>&nbsp;</th>
        <th>&nbsp;</th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>Key:</td>
        <td>
            <input type="text" size="120" maxlength="300" name="gmapKey" value="">            
        </td>
    </tr>
</tbody>
<tfoot>
    <tr>
        <td colspan="2">
            <input type="submit" name="add" value="Add key">
        </td>
    </tr>
</tfoot>
</table>
</div>
</form> 
<br/>
<p>
The <em>Member Map Plugin</em> maps an address in one of the user profile fields
to a geocoded location (latitude and longitude).  
In addition, a user may indicate that they do not wish to have location displayed on member maps.
Finally, you can indicate the profile fields to display in the InfoWindows on the member maps. 
</p>
<p>
Use the form below to indicate the profile field to use for the user's address, the profile field that
controls whether the user's location is displayed on member maps, and the profile fields to display in
InfoWindows.
</p>
<form action="members-admin.jspa"  method="post" name="setAddress">

<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
    <tr>
        <th>&nbsp;</th>
        <th>&nbsp;</th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>Address Field:</td>
        <td align="left">
          <select name="addressField">
          <option value='0'>Select a field....</option>
	        <#list textProfileFields as field>
	        	<option value='${field.ID?c}' <#if field.ID?c == selectedAddressField> selected='true'</#if>>${field.name}</option>
	        </#list>
		  </select>          
        </td>
    </tr>
    <tr>
        <td>Display Field:</td>
        <td align="left">
          <select name="displayField">
          <option value='0'>Select a field....</option>
	        <#list booleanProfileFields as field>
	        	<option value='${field.ID?c}' <#if field.ID?c == selectedDisplayField> selected='true'</#if>>${field.name}</option>
	        </#list>
		  </select>          
        </td>
    </tr>
    <tr>
        <td>Group Field:</td>
        <td align="left">
          <select name="groupField">
          <option value='0'>Select a field....</option>
	        <#list listProfileFields as field>
	        	<option value='${field.ID?c}' <#if field.ID?c == selectedGroupField> selected='true'</#if>>${field.name}</option>
	        </#list>
		  </select>          
        </td>
    </tr>
    <tr>
        <td>InfoWindow Fields:</td>
        <td align="left">
          <select name="infoFields" multiple="true" size="5">
	        <#list profileFields as field>
	        	<option value='${field.ID?c}' <#if isDisplayedField(field.ID?c)> selected='true'</#if>>${field.name}</option>
	        </#list>
		  </select>          
        </td>
    </tr>
</tbody>
<tfoot>
    <tr>
        <td colspan="2">
            <input type="submit" name="set" value="Set fields">
        </td>
    </tr>
</tfoot>
</table>
</div>
</form> 

        

    </div>
	<!-- END body area -->  

  
  </body>
</html>